#!/usr/bin/env bash

if [ $UID -ne 0 ]; then
    echo "Superuser privileges are required to run this script."
    echo "e.g. \"sudo $0\""
    exit 1
fi
echo "installing device-mapper-persistent-data lvm2"
yum install -y yum-utils device-mapper-persistent-data lvm2
echo "installed successfully, start to install docker"
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

yum makecache fast
echo "installing docker-ce"
yum -y install docker-ce
echo "installed successfully, to start docker"
systemctl enable docker
systemctl start docker
echo "docker started";

#echo "adding docker-compose..."
#curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
#chmod +x /usr/local/bin/docker-compose
#
#sudo chmod +x /usr/local/bin/docker-compose
#
#echo "completed!!!"
